﻿@using System.Web.Mvc
@using System.Web.Mvc.Html
@using Matrix.MaKaYunShang.Model
@using Matrix.Common.Utility
@using Matrix.MaKaYunShang.Model
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
    <script src="~/Content/js/jquery.lazyload.js"></script>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div>
        <table>
            <tr>
                <td>
                    @{
                        List<Shops> m = ViewBag.MerchantList;
                        m.Add(new Shops() { Id = -1, Name = "请选择商家" });
                        m = m.ToList().OrderBy(s => s.Id).ToList();
                    }
                    @Html.DropDownList("Id", new SelectList(m, "Id", "Name"), new { @class = "form-control" })
                </td>
            </tr>
            @*<tr>
                <td><input type="button" value="生成出单二维码" onclick="CashCardText(@Model.Id)" /></td>
                <td><textarea id="CashCardText" style="width: 700px;"></textarea></td>
            </tr>*@
            <tr>
                <td><input type="button" value="生成可变二维码" onclick="VariableQrCodeText(@Model.Id)" /></td>
                <td><textarea id="VariableQrCodeText" style="width: 700px;"></textarea></td>
            </tr>
            <tr>
                <td> 固定二维码:</td>
                <td>
                    <textarea id="VariableQrCodeText" style="width: 700px;">@Model.FixedQrCode</textarea>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <img src="http://qr.topscan.com/api.php?text=@Model.FixedQrCode" id="imgUrl" style="width: 300px" />
                </td>
            </tr>
        </table>
    </div>
    <script>

        $(function() {
            $(".form-control").change(function () {
           
                var ss = $("#Id option:selected").val();
       
                location.href = "/Home/MCode/" + ss;
            });
        });
        function CashCardText(parameters) {
            $.post("/Home/CashCardText", { id: parameters }, function (data) {
                $("#CashCardText").html(data.Message);
            })
        }
        function VariableQrCodeText(parameters) {
            $.post("/Home/VariableQrCodeText", { id: parameters }, function(data) {
                $("#VariableQrCodeText").html(data.Message);
            });
        }
    </script>
</body>
</html>
